/*
  File: SystemMenu.cs
  Author: rcrxy
  CreateTime: 2025/06/26 17:42

  Description: 页面配置
*/

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace StudentVideo.Data.Entities;

/// <summary>
/// 管理系统菜单
/// </summary>
[Table("system_menu")]
[Index(nameof(Path), IsUnique = true)]
public class SystemMenuEntity: BaseEntity {
   /// <summary>
   /// 菜单名称
   /// </summary>
   [Required]
   [MaxLength(50)]
   [Column(Order = 2)]
   public required string Name { get; set; }

   /// <summary>
   /// 菜单路径
   /// </summary>
   [MaxLength(100)]
   [Column(Order = 3)]
   public required string Path { get; set; }

   /// <summary>
   /// 菜单图标
   /// </summary>
   [MaxLength(100)]
   [Column(Order = 4)]
   public string? Icon { get; set; }

   /// <summary>
   /// 父菜单 id
   /// </summary>
   [MaxLength(50)]
   public string? ParentId { get; set; }

   /// <summary>
   /// 是否启用
   /// </summary>
   public bool Enable { get; set; } = true;

   /// <summary>
   /// 排序 - 同父级下的顺序
   /// </summary>
   [Column(TypeName = "tinyint")]
   public int Sort { get; set; } = -1;

   [InverseProperty(nameof(RoleSystemMenuMapEntity.SystemMenu))]
   public ICollection<RoleSystemMenuMapEntity>? RoleSystemMenuMap { get; set; }
}
